// 导航栏渲染
$(function(){

    // 发请求
    getNav()
    function getNav(){
        $.ajax({
            method:'get',
            url:' http://124.223.14.236:8060/index/index',
            success:function(res){
                // console.log(res);
                if(res.errno !== 0){
                    return '获取失败'
                }
                // console.log('获取成功');

                let navList = res.data.allCate; //获得数据
               let navInfo =  navList.map( (item) => `
                <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-menu-item current_page_item">
            <a title="" href="index.html"><span class="fa fa-home"></span>${item.catename}</a>
          </li>
                ` ).join(' ')
             
                $('.nav').html(`
                <li class="navmore"></li>
                <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-menu-item current_page_item">
                  <a title="" href="index.html"><span class="fa fa-home"></span>趣·首页</a>
                </li>
                `+ navInfo)
            }
        })
    }




})